Vue.component('treeselect', VueTreeselect.Treeselect)


Vue.component('tree-area', {
    props: ['value', 'multiple'],
    data: function () {
        return {
            data: [],
        }
    },
    methods: {
        input: function (v, instanceId) {
            this.$emit('input', v);
        },
        getData: function () {
            this.data = GetAreaTreeData(null, null);
        }
    },
    mounted: function () {
        this.getData();
    },
    template: '<treeselect v-model="value" @input="input"  :options="data" :flat="true" slot="suffix" style="line-height: 28px;width:30%;" :disable-branch-nodes="true"/> '
    //template: '<div>122222</div> '
})



Vue.component('tree-department-staff', {
    props: ['value', 'multiple'],
    data: function () {
        return {
            options: [],
            rawData: [],
            valueConsistsOf: "LEAF_PRIORITY"
        }
    },
    methods: {
        input: function (v, instanceId) {
            console.log(v);
            this.$emit('input', v);
        },
        getData: function () {
            var app = this;
            myAjax("Get", null, "/api/Tree/GetTreeDepartmentStaff", null, function (response) {
                var ajaxModel = response.data;
                app.rawData = ajaxModel;
                app.options = PersonMenuHelper(ajaxModel, guidEmpty);
            }, false);
        }, select: function (node) {
            this.$emit('select', node, this.rawData);
        }
    },
    mounted: function () {
        this.getData();
    },
    template: ' <treeselect :multiple="multiple"   :value-consists-of="valueConsistsOf"  :options="options"    v-model="value" @input="input" @select="select"  />'

})


Vue.component('tree-department-staff-single', {
    props: ['value', 'multiple'],
    data: function () {
        return {
            options: [],
            valueConsistsOf: "LEAF_PRIORITY"
        }
    },
    methods: {
        input: function (v, instanceId) {
            console.log(v);
            this.$emit('input', v);
        },
        getData: function () {
            var app = this;
            myAjax("Get", null, "/api/Tree/GetTreeDepartmentStaff", null, function (response) {
                var ajaxModel = response.data;
                app.options = PersonMenuHelper(ajaxModel, guidEmpty);
            }, false);
        }
    },
    mounted: function () {
        this.getData();
    },
    template: ' <treeselect :multiple="multiple"     :disable-branch-nodes="true"   :value-consists-of="valueConsistsOf"  :options="options"    v-model="value" @input="input"  />'

})




Vue.component('tree-department', {
    props: ['value', 'multiple'],
    data: function () {
        return {
            options: [],
            valueConsistsOf: "LEAF_PRIORITY"
        }
    },
    methods: {
        input: function (v, instanceId) {
            console.log(v);
            this.$emit('input', v);
        },
        getData: function () {
            var app = this;
            myAjax("Post", null, "/api/SysDepartment/GetList", {
                "model": {

                },
                "offset": 0,
                "limit": 10
            }, function (response) {
                var ajaxModel = response.data.pageData;
                app.options = departmentHelper(ajaxModel, null);
            }, false);
        }
    },
    mounted: function () {
        this.getData();
    },
    template: ' <treeselect :multiple="multiple"     :disable-branch-nodes="true"   :value-consists-of="valueConsistsOf"  :options="options"    v-model="value" @input="input"  />'

})



Vue.component('tree-doubledepartment-staff-single', {
    props: ['value', 'multiple'],
    data: function () {
        return {
            options: [],
            valueConsistsOf: "LEAF_PRIORITY"
        }
    },
    methods: {
        input: function (v, instanceId) {
            console.log(v);
            this.$emit('input', v);
        },
        getData: function () {
            var app = this;
            myAjax("Get", null, "/api/Tree/GetTreeDoubleDepartmentStaff", null, function (response) {
                var ajaxModel = response.data;
                app.options = PersonMenuHelper(ajaxModel, guidEmpty);
            }, false);
        }
    },
    mounted: function () {
        this.getData();
    },
    template: ' <treeselect :multiple="multiple"     :disable-branch-nodes="true"   :value-consists-of="valueConsistsOf"  :options="options"    v-model="value" @input="input"  />'

})